package com.chinasofti.manager.domain;

import java.util.Scanner;

public class Demo12 {
    public static void main(String[] args) {
        System.out.println("请输入文明语言");
//        替换敏感词汇
//        1.键入语句
        Scanner sc = new Scanner(System.in);
        String inputWord = sc.nextLine();
//        3.接收替换后语句
        String changeWord = searchChange(inputWord);
//        4.输出查看
        System.out.println(changeWord);
    }

    //    2.设置筛查方法
    public static String searchChange(String word) {
//        定义敏感词汇库
        String[] arr = {"尼玛", "nnd", "NND", "TMD", "有病"};
//        循环根据词库查找替换
        for (int i = 0; i < arr.length; i++) {
            word = word.replace(arr[i], "***");
        }
        return word;
    }
}
